#include "core/main.h"

namespace mike
{    
    static bool sIsInitialized = false;
    static LARGE_INTEGER sPreviousCount, sCurrentCount;
    
    double TimeGetTimeDeltaSeconds()
    {
        LARGE_INTEGER frequency;
        
        QueryPerformanceFrequency( &frequency );
        QueryPerformanceCounter( &sCurrentCount );
        
        __int64 countDelta = sCurrentCount.QuadPart - sPreviousCount.QuadPart;
        sPreviousCount     = sCurrentCount;
        
        if ( !sIsInitialized )
        {
            sIsInitialized = true;
            return 0;
        }
        else
        {
            double timeDeltaSeconds = static_cast< double >( countDelta ) / static_cast< double >( frequency.QuadPart );
            
            return timeDeltaSeconds;
        }
    }
}
